<!doctype html>
<html>
<head>
  <meta charset='utf-8'>
  <title>Column &amp; row resize - Handsontable</title>

  <!--
  Loading Handsontable (full distribution that includes all dependencies apart from jQuery)
  -->

  <script data-jsfiddle="common" src="../dist/handsontable.full.js"></script>
  <link data-jsfiddle="common" rel="stylesheet" media="screen" href="../dist/handsontable.full.css">

  <!--
  Loading demo dependencies. They are used here only to enhance the examples on this page
  -->
  <link data-jsfiddle="common" rel="stylesheet" media="screen" href="css/samples.css?20140331">
  <script src="js/samples.js"></script>
  <script src="js/highlight/highlight.pack.js"></script>
  <link rel="stylesheet" media="screen" href="js/highlight/styles/github.css">
  <link rel="stylesheet" href="css/font-awesome/css/font-awesome.min.css">

  <!--
  Facebook open graph. Don't copy this to your project :)
  -->
  <meta property="og:title" content="Column resize">
  <meta property="og:description"
        content=".">
  <meta property="og:url" content="http://handsontable.com/demo/column_resize.html">
  <meta property="og:image" content="http://handsontable.com/demo/image/og-image.png">
  <meta property="og:image:type" content="image/png">
  <meta property="og:image:width" content="409">
  <meta property="og:image:height" content="164">
  <link rel="canonical" href="http://handsontable.com/demo/column_resize.html">

  <!--
  Google Analytics for GitHub Page. Don't copy this to your project :)
  -->
  <script src="js/ga.js"></script>
</head>

<body>


<div class="wrapper">
  <div class="wrapper-row">
    <div id="global-menu-clone">
      <h1><a href="../index.html">Handsontable</a></h1>

    </div>

    <div id="container">
      <div class="columnLayout">

    <div class="rowLayout">
      <div class="descLayout">
        <div class="pad" data-jsfiddle="example1">
          <a name="resize"></a>

          <h2>Column &amp; row resize</h2>

          <p>To enable these features, use settings <code>manualColumnResize: true</code> and <code>manualRowResize: true</code></p>

          <p>The draggable resize handle appears:</p>

          <ul>
            <li>in the right part of the column header,</li>
            <li>in the bottom part of the row header.</li>
          </ul>

          <p>Double click on the resize handle automatically adjusts size of the row or column.</p>

          <div class="state-loaded example1 alert">State of the table has been restored. <button class="mini reset-state1">Reset table state</button></div>
          <div id="example1" style="width: 400px; height: 300px; overflow: scroll"></div>

          <p>
            <button name="dump" data-dump="#example1" data-instance="hot" title="Prints current data source to Firebug/Chrome Dev Tools">
              Dump
              data to console
            </button>
          </p>
        </div>
      </div>

      <div class="codeLayout">
        <div class="pad">
          <div class="jsFiddle">
            <button class="jsFiddleLink" data-runfiddle="example1">Edit in jsFiddle</button>
          </div>

          <script data-jsfiddle="example1">
            var container = document.getElementById('example1'),
              hot;

            hot = new Handsontable(container, {
              data: Handsontable.helper.createSpreadsheetData(1000, 10),
              rowHeaders: true,
              colHeaders: true,
              colWidths: [55, 80, 80, 80, 80, 80, 80],
              rowHeights: [50, 40, 100],
              manualColumnResize: true,
              manualRowResize: true,
              minSpareRows: 1,
              persistentState: true
            });
          </script>

        </div>
      </div>
    </div>

        <script type="text/javascript">
          (function(hot){
            var reset = document.querySelector('.reset-state1'),
              stateLoaded = document.querySelector('.state-loaded'),
              storedData = {},
              savedKeys;

            Handsontable.Dom.addEvent(reset, 'click', function(){
              hot.runHooks('persistentStateReset');
              hot.updateSettings({
                manualColumnMove: true,
                manualRowMove: true,
                manualColumnResize: true,
                manualRowResize: true
              });
              stateLoaded.style.display = 'none';
              hot.render();
            });

            hot.runHooks('persistentStateLoad', '_persistentStateKeys', storedData);
            savedKeys = storedData.value;

            if (savedKeys && savedKeys.length > 0) {
              stateLoaded.style.display = 'block';
              hot.render();
            }
          })(hot);

        </script>



        <div class="footer-text">Handsontable &copy; 2012-2014 Marcin Warpechowski and contributors.<br> Code and documentation
          licensed under the The MIT License.
        </div>
      </div>

    </div>

  </div>
</div>

<div id="outside-links-wrapper"></div>

</body>
</html>
